<?php
/**
 * Vortal action controller
 * 
 * @author paq
 *
 */
class Controller_Vortal extends Controller_Action
{
	public function __construct(Controller_Front $frontController)
	{
		parent::__construct('vortal', $frontController);
	}
		
	public function indexAction()
	{
		$criteria = new Criteria();
		
		if (isset($_GET['id_vortal'])) {
			$criteria->add(NewsPeer::ID_VORTAL, $_GET['id_vortal'], Criteria::EQUAL);
			$criteria->addDescendingOrderByColumn(NewsPeer::DATE);
			$news = NewsPeer::doSelect($criteria);
			$this->view()->assign('news', $news);
			return $this->view()->display('news.tpl');
		}
		
		$vortals = VortalsPeer::doSelect($criteria);
		
		$this->view()->assign('vortals', $vortals);
		$this->view()->display('vortals.tpl');
	}
	
	public function rulesAction()
	{
		$this->view()->display('regulamin.tpl');
	}
}